package org.shoukaiseki.aqoeous.handler;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageSerializable;
import org.shoukaiseki.aqoeous.model.TriggerHandlerParam;

import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 *
 **/
public interface AqoeousTriggerHandler {

//JSONObject jo=(JSONObject)JSONObject.toJSON(model)

    /**
     * <pre>
     *    列表add行之前处理
     * </pre>
     * @param jo
     * @return   会把返回的add到list中,
     */
    default @NotNull Object listAddBefore(@NotNull TriggerHandlerParam args){
        //列表行数据
        JSONObject row= args.getRow();
        if(args.getRowType()==1){
            return args.getModel();
        }
       return row;
    }


    //查询前 执行,用于关联查询时
    default PageSerializable customQOParserBefore(TriggerHandlerParam triggerHandlerParam){
//        String resultName = triggerHandlerParam.getResultName();
//        Map<String, Object> resultMap = triggerHandlerParam.getResultMap();

//        CustomQOProcessor customQOProcessor = (CustomQOProcessor)triggerHandlerParam.getCustomQOProcessor();
        return null;
    }

}
